package com.jfree.nettyshow.client.handler;

import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandlerAdapter;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

/**
 * @author wangjian
 * @date 2019/10/28 11:10
 */
public class ClientHandler extends ChannelInboundHandlerAdapter {

    public static Map<String, ChannelHandlerContext> map = new ConcurrentHashMap<>();

    @Override
    public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
        super.channelRead(ctx, msg);
        //msg relase？？？
    }

    @Override
    public void channelActive(ChannelHandlerContext ctx) throws Exception {
        /**
         *做成springboot服务，能一直访问来发送数据，看看先发送不正常的数据再发送正常的，服务端能否正常解析。
         */

        map.put(String.valueOf(Math.random()), ctx);
    }

    public static void main(String[] args) {
        System.out.println(Integer.toHexString(0xC));
    }
}
